package com.xueyi.workflow.util;

import com.xueyi.workflow.domain.dto.GraphSchema;
import java.util.*;

/**
 * 标准 GraphSchema 的 BPMN XML 生成器
 * 处理标准的 GraphSchema 格式数据
 * 
 * @author xueyi
 */
public class GraphSchemaBpmnGenerator extends AbstractBpmnGenerator {
    
    @Override
    public String generateBpmnXml(GraphSchema schema, String processId, String processName) {
        // 使用原有的生成逻辑
        return LegacyBpmnGenerator.generateBpmnXml(schema, processId, processName);
    }
    
    @Override
    public String generateBpmnXmlFromRawData(Object rawData, String processId, String processName) {
        if (rawData instanceof GraphSchema) {
            return generateBpmnXml((GraphSchema) rawData, processId, processName);
        } else {
            throw new IllegalArgumentException("GraphSchemaBpmnGenerator 只支持 GraphSchema 类型的数据");
        }
    }
    
    @Override
    public boolean supports(Object rawData) {
        return rawData instanceof GraphSchema;
    }
    
    @Override
    public GraphSchema convertToGraphSchema(Object rawData) {
        if (rawData instanceof GraphSchema) {
            return (GraphSchema) rawData;
        } else {
            throw new IllegalArgumentException("GraphSchemaBpmnGenerator 只支持 GraphSchema 类型的数据");
        }
    }
}
